# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=('isl' 'isl-devel')
pkgver=0.19
pkgrel=1
pkgdesc="Library for manipulating sets and relations of integer points bounded by linear constraints"
arch=('i686' 'x86_64')
url="http://isl.gforge.inria.fr/"
groups=('libraries')
depends=('gmp')
makedepends=('gmp-devel')
license=('MIT')
source=(http://isl.gforge.inria.fr/${pkgname}-$pkgver.tar.xz
        isl-0.12.1-msys2.patch
        isl-0.14.1-no-undefined.patch)
sha256sums=('6d6c1aa00e2a6dfc509fa46d9a9dbe93af0c451e196a670577a148feecf6b8a5'
            'cd29dc28cc9905b15d18ca0de66752c0587cd06485115b9892ea53ec39c59d35'
            '83655a7202f0a0dcce1782d4b365252bf1ad12a522b7ad82ab578ee5ec46433b')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/isl-0.12.1-msys2.patch
  patch -p1 -i ${srcdir}/isl-0.14.1-no-undefined.patch

  autoreconf -fi
}

build() {
  cd "$srcdir/${pkgname}-${pkgver}"
  ./configure --prefix=/usr --enable-shared --disable-static
  make
  make -j1 DESTDIR="${srcdir}/dest" install
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package_isl() {
  mkdir -p ${pkgdir}/usr/bin
  cp -f ${srcdir}/dest/usr/bin/*.dll ${pkgdir}/usr/bin

  install -Dm644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/isl/LICENSE
}

package_isl-devel() {
  pkgdesc="ISL headers and libraries"
  groups=('development')
  depends=("isl=${pkgver}" 'gmp-devel')

  mkdir -p ${pkgdir}/usr

  cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
  cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
}
